<?php

class Application_Form_Login extends Zend_Form
{
	protected $user;
	protected $pass;
	protected $submit;
	
    public function init()
    {
        $this->setName('login');
				
        $this->user = new Zend_Form_Element_Text('user');
        $this->user
        			->setRequired(true)
             		->addFilter('StripTags')
             		->addFilter('StringTrim')
             		->addValidator('NotEmpty')
             		->addValidator('EmailAddress', TRUE);
 
        $this->pass = new Zend_Form_Element_Password('pass');
        $this->pass
                 ->setRequired(true)
              	 ->addFilter('StripTags')
              	 ->addFilter('StringTrim')
              	 ->addValidator('NotEmpty');
              	 
        $this->submit = new Zend_Form_Element_Submit('submit');
        $this->submit->setLabel('Ok');
 
        $this->addElements(array($this->user, $this->pass, $this->submit));
        
        self::removeDecorators($this);
    }
	
    public static function removeDecorators($form){
		foreach ( $form->getElements() as $element ){
			$element->removeDecorator('HtmlTag')
			         ->removeDecorator('errors')
                     ->removeDecorator('label');
		}
	}

}

